package com.jacobson.core.widget.storage

import java.util.concurrent.ConcurrentHashMap

/**
 * ================================================
 *
 * @author Wucz on 2018/8/6 10:38
 * ================================================
 */
object GlobalStorage : Storage<String, Any> {
    private val mutableCachedMap: MutableMap<String, Any> = ConcurrentHashMap()

    override fun get(key: String): Any? = mutableCachedMap[key]

    override fun put(key: String, value: Any): Any? = mutableCachedMap.put(key, value)

    override fun remove(key: String): Any? = mutableCachedMap.remove(key)

    override fun size(): Int = mutableCachedMap.size

    override fun containsKey(key: String): Boolean = mutableCachedMap.containsKey(key)

    override fun keySet(): Set<String> = mutableCachedMap.keys

    override fun clear() = mutableCachedMap.clear()
}
